<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>10.rest参数代替arguments</title>
</head>
<body>

<script>
  //es5之前的写法
  function f1(a,b,c,d){
    console.log(arguments)
  }

  f1(1,2,3,4)

  //es6的写法
  function f2(a,b,...rest){
      console.log(a)
      console.log(b)
      console.log(rest)
  }

  f2(1,2,3,4)

  //rest必须写在参数的最后一个
  // function f3(a,...rest,b){
  //     console.log(a)
  //     console.log(b)
  //     console.log(rest)
  // }

</script>
</body>
</html>